Provide a more robust error message if JSON is invalid.#177
Provide a more robust error message if JSON is invalid.#177kytrinyx merged 2 commits intoexercism:masterfrom
Conversation
|
Current output looks like this: Here's an example output of how it would look if we were to highlight the syntax error Thoughts? Not sure if it adds any more value. |
|
Would it be possible to add full path to the config and number of line causing the error? |
|
Each bit more of info you can supply to folks always helps, I say. :] |
@mtakac The full path will be displayed, I changed it for the example but it will look like Adding the line number should be trivial but the issue is that the config file is usually just 1 line unless the user modifies it to be pretty.
Definitely! Though I wanted to get feedback in case too much info can be overwhelming for the user but I guess it couldn't hurt in this scenario since they're already running into an issue. |
|
👍 looks great and clear. |
|
The latest commit makes the error output: |
|
We could also write the config file pretty--it's not costly for such a small file, and if it would make it easier to give good error messages, that's a plus. |
|
@kytrinyx sure, do you want me to get that in with this PR or in a different one? |
|
|
|
Thanks @Tonkpils! |
Provide a more robust error message if JSON is invalid.
Fixes #170
With
json.SyntaxErrorwe also have theOffsetat which the error is, so we can highlight where the syntax error is. I can work on that if that's something we want but this should be enough to get going.